<template>
	<view class="box">
		<u-navbar :is-back="true" title="修改密码"></u-navbar>
		<view class="container">
			<u-form :model="form" ref="form1" :error-type="errorType">
				<u-form-item prop="old">
					<view class="ipt flc">
						<view class="icon">
							<u-icon :name="'/static/icons/lock.png'" size="26"></u-icon>
						</view>
						<u-input class="ml2" v-model="form.old" placeholder="请输入您的旧密码" />
					</view>
				</u-form-item>
				<u-form-item prop="password">
					<view class="ipt flc">
						<view class="icon">
							<u-icon :name="'/static/icons/lock.png'" size="26"></u-icon>
						</view>
						<u-input class="ml2" v-model="form.password" placeholder="请输入密码" />
					</view>
				</u-form-item>
				<u-form-item prop="rPassword">
					<view class="ipt flc">
						<view class="icon">
							<u-icon :name="'/static/icons/lock.png'" size="26"></u-icon>
						</view>
						<u-input class="ml2" v-model="form.rPassword" placeholder="请输入密码" />
					</view>
				</u-form-item>
			</u-form>
			<view class="btn" @click="submit">
				确认找回
			</view>
			
		</view>


	</view>

</template>

<script>
	import {
		getLogo
	} from '../../api/index';
	export default {
		data() {
			return {
				errorType:['toast'],
				form: {
					old: '',
					password: "",
					rPassword: "",
				},
				rules: {
					old: [{
						required: true,
						message: '请输入您的旧密码',
						trigger: ['change', 'blur']
					}],
					password: [{
						required: true,
						message: '请输入密码',
						trigger: ['change', 'blur']
					}],
					rPassword: [{
							required: true,
							message: '请再次输入密码',
							trigger: ['change', 'blur']
						},
						{
							validator: (rule, value, callback) => {
								return value == this.form.password;
							},
							message: '两次密码不一致'
						},
					],
					code: [{
						required: true,
						message: '请输入验证码',
						trigger: ['change', 'blur']
					}],

				}
			};
		},
		onReady() {
			this.$refs.form1.setRules(this.rules);
		},
		onLoad() {
			
		},
		methods: {
			submit() {
				this.$refs.form1.validate((valid) => {
					console.log(valid);
					if (valid) {
						uni.showToast({
							icon: "none",
							title: "表单验证通过"
						})
					}
				})
			},
		}
	};
</script>

<style lang="scss" scoped>
	.container {
		margin-top: 20rpx;
		background-color: #fff;
		width: 750rpx;
		height: calc(100vh - 96rpx);
		box-sizing: border-box;
		padding: 20rpx;
	}

	.logo {
		width: 200rpx;
		height: 200rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 10rpx 20rpx 0rpx rgba(51, 51, 51, 0.1);
		border-radius: 30rpx;
		margin: 40rpx auto;
		box-sizing: border-box;
		padding: 42rpx 17rpx;
	}

	.title {
		height: 40rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		font-size: 42rpx;
		margin: 40rpx 0;
	}

	.label {
		min-width: 60rpx;
	}

	.forgetPassword {
		text-align: right;
		font-size: 28rpx;
		margin: 20rpx 0;
	}

	.btn {
		width: 650rpx;
		height: 80rpx;
		background: linear-gradient(90deg, #FD4120, #F47749);
		border-radius: 40rpx;
		margin: 40rpx auto;
		text-align: center;
		line-height: 80rpx;
		font-size: 30rpx;
		color: #FFFFFF;

	}

	.tips {
		font-size: 28rpx;
		text-align: center;
		width: 710rpx;
		display: flex;
		justify-content: center;
	}

	.ml6 {
		margin-left: 60rpx;
	}

	.aggrement {
		margin-top: 40rpx;
		width: 710rpx;
		box-sizing: border-box;

		.agree {
			width: 32rpx;
			height: 32rpx;
			border-radius: 50%;
		}

		.aggrementC {
			height: 32rpx;
			line-height: 32rpx;
		}
	}
</style>